package com.google.android.material.appbar;

import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.os.Build.VERSION;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.ClassLoaderCreator;
import android.os.Parcelable.Creator;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.coordinatorlayout.widget.CoordinatorLayout.DefaultBehavior;
import androidx.coordinatorlayout.widget.CoordinatorLayout.a;
import androidx.core.view.ViewCompat;
import androidx.customview.view.AbsSavedState;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import o.aqu.f;
import o.aqu.n;
import o.aqv;
import o.arf;
import o.asa;
import o.gr;
import o.gz;
import o.hq;
import o.hx;
import o.ij;

@DefaultBehavior(Behavior.class)
public class AppBarLayout extends LinearLayout {
    private boolean ʻ;
    private ij ʼ;
    private boolean ʽ;
    private int ˊ;
    private int ˋ;
    private int ˎ;
    private boolean ˏ;
    private int[] ͺ;
    private int ॱ;
    private boolean ॱˊ;
    private boolean ॱॱ;
    private List<d> ᐝ;

    protected static class BaseBehavior<T extends AppBarLayout> extends HeaderBehavior<T> {
        private float ʻ;
        private boolean ʽ;
        private ValueAnimator ˊ;
        private int ˎ;
        private int ˏ;
        private int ॱ = -1;
        private WeakReference<View> ॱॱ;
        private d ᐝ;

        protected static class SavedState extends AbsSavedState {
            public static final Creator<SavedState> CREATOR = new ClassLoaderCreator<SavedState>() {
                public /* synthetic */ Object createFromParcel(Parcel parcel) {
                    return ˊ(parcel);
                }

                public /* synthetic */ Object createFromParcel(Parcel parcel, ClassLoader classLoader) {
                    return ॱ(parcel, classLoader);
                }

                public /* synthetic */ Object[] newArray(int i) {
                    return ॱ(i);
                }

                public SavedState ॱ(Parcel parcel, ClassLoader classLoader) {
                    return new SavedState(parcel, classLoader);
                }

                public SavedState ˊ(Parcel parcel) {
                    return new SavedState(parcel, null);
                }

                public SavedState[] ॱ(int i) {
                    return new SavedState[i];
                }
            };
            boolean ˋ;
            float ˏ;
            int ॱ;

            public SavedState(Parcel parcel, ClassLoader classLoader) {
                super(parcel, classLoader);
                this.ॱ = parcel.readInt();
                this.ˏ = parcel.readFloat();
                this.ˋ = parcel.readByte() != (byte) 0;
            }

            public SavedState(Parcelable parcelable) {
                super(parcelable);
            }

            public void writeToParcel(Parcel parcel, int i) {
                super.writeToParcel(parcel, i);
                parcel.writeInt(this.ॱ);
                parcel.writeFloat(this.ˏ);
                parcel.writeByte((byte) (this.ˋ ? 1 : 0));
            }
        }

        public static abstract class d<T extends AppBarLayout> {
            public abstract boolean ˏ(@NonNull T t);
        }

        /* synthetic */ void ˊ(CoordinatorLayout coordinatorLayout, View view) {
            ॱ(coordinatorLayout, (AppBarLayout) view);
        }

        public /* synthetic */ void ˊ(CoordinatorLayout coordinatorLayout, View view, Parcelable parcelable) {
            ˎ(coordinatorLayout, (AppBarLayout) view, parcelable);
        }

        /* synthetic */ int ˋ(View view) {
            return ˎ((AppBarLayout) view);
        }

        /* synthetic */ int ˋ(CoordinatorLayout coordinatorLayout, View view, int i, int i2, int i3) {
            return ˊ(coordinatorLayout, (AppBarLayout) view, i, i2, i3);
        }

        public /* synthetic */ void ˎ(CoordinatorLayout coordinatorLayout, View view, View view2, int i, int i2, int[] iArr, int i3) {
            ˏ(coordinatorLayout, (AppBarLayout) view, view2, i, i2, iArr, i3);
        }

        /* synthetic */ boolean ˎ(View view) {
            return ˋ((AppBarLayout) view);
        }

        public /* synthetic */ boolean ˎ(CoordinatorLayout coordinatorLayout, View view, int i) {
            return ॱ(coordinatorLayout, (AppBarLayout) view, i);
        }

        public /* synthetic */ boolean ˎ(CoordinatorLayout coordinatorLayout, View view, int i, int i2, int i3, int i4) {
            return ˏ(coordinatorLayout, (AppBarLayout) view, i, i2, i3, i4);
        }

        public /* synthetic */ void ॱ(CoordinatorLayout coordinatorLayout, View view, View view2, int i, int i2, int i3, int i4, int i5) {
            ˋ(coordinatorLayout, (AppBarLayout) view, view2, i, i2, i3, i4, i5);
        }

        public BaseBehavior(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
        }

        public boolean ˏ(CoordinatorLayout coordinatorLayout, T t, View view, View view2, int i, int i2) {
            boolean z = (i & 2) != 0 && (t.ᐝ() || ॱ(coordinatorLayout, (AppBarLayout) t, view));
            if (z && this.ˊ != null) {
                this.ˊ.cancel();
            }
            this.ॱॱ = null;
            this.ˎ = i2;
            return z;
        }

        private boolean ॱ(CoordinatorLayout coordinatorLayout, T t, View view) {
            return t.ˏ() && coordinatorLayout.getHeight() - view.getHeight() <= t.getHeight();
        }

        public void ˏ(CoordinatorLayout coordinatorLayout, T t, View view, int i, int i2, int[] iArr, int i3) {
            if (i2 != 0) {
                int i4;
                int ʽ;
                if (i2 < 0) {
                    i4 = -t.ॱ();
                    ʽ = i4 + t.ʽ();
                } else {
                    i4 = -t.ˊ();
                    ʽ = 0;
                }
                if (i4 != ʽ) {
                    iArr[1] = ˏ(coordinatorLayout, (View) t, i2, i4, ʽ);
                    ˎ(i2, t, view, i3);
                }
            }
        }

        public void ˋ(CoordinatorLayout coordinatorLayout, T t, View view, int i, int i2, int i3, int i4, int i5) {
            boolean z = false;
            if (i4 < 0) {
                ˏ(coordinatorLayout, (View) t, i4, -t.ʻ(), 0);
                ˎ(i4, t, view, i5);
            }
            if (t.ᐝ()) {
                if (view.getScrollY() > 0) {
                    z = true;
                }
                t.ˊ(z);
            }
        }

        private void ˎ(int i, T t, View view, int i2) {
            if (i2 == 1) {
                int ˏ = ˏ();
                if ((i < 0 && ˏ == 0) || (i > 0 && ˏ == (-t.ʻ()))) {
                    ViewCompat.ॱ(view, 1);
                }
            }
        }

        public void ॱ(CoordinatorLayout coordinatorLayout, T t, View view, int i) {
            if (this.ˎ == 0 || i == 1) {
                ˋ(coordinatorLayout, (AppBarLayout) t);
            }
            this.ॱॱ = new WeakReference(view);
        }

        private void ˊ(CoordinatorLayout coordinatorLayout, T t, int i, float f) {
            int abs = Math.abs(ˏ() - i);
            float abs2 = Math.abs(f);
            if (abs2 > 0.0f) {
                abs = Math.round((((float) abs) / abs2) * 1000.0f) * 3;
            } else {
                abs = (int) (((((float) abs) / ((float) t.getHeight())) + 1.0f) * 150.0f);
            }
            ˋ(coordinatorLayout, t, i, abs);
        }

        private void ˋ(final CoordinatorLayout coordinatorLayout, final T t, int i, int i2) {
            if (ˏ() != i) {
                if (this.ˊ == null) {
                    this.ˊ = new ValueAnimator();
                    this.ˊ.setInterpolator(aqv.ˋ);
                    this.ˊ.addUpdateListener(new AnimatorUpdateListener(this) {
                        final /* synthetic */ BaseBehavior ˏ;

                        public void onAnimationUpdate(ValueAnimator valueAnimator) {
                            this.ˏ.a_(coordinatorLayout, t, ((Integer) valueAnimator.getAnimatedValue()).intValue());
                        }
                    });
                } else {
                    this.ˊ.cancel();
                }
                this.ˊ.setDuration((long) Math.min(i2, 600));
                this.ˊ.setIntValues(new int[]{r0, i});
                this.ˊ.start();
            } else if (this.ˊ != null && this.ˊ.isRunning()) {
                this.ˊ.cancel();
            }
        }

        private int ˎ(T t, int i) {
            int childCount = t.getChildCount();
            for (int i2 = 0; i2 < childCount; i2++) {
                View childAt = t.getChildAt(i2);
                int top = childAt.getTop();
                int bottom = childAt.getBottom();
                LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
                int i3;
                if (ˏ(layoutParams.ˏ(), 32)) {
                    top -= layoutParams.topMargin;
                    i3 = layoutParams.bottomMargin + bottom;
                    bottom = top;
                } else {
                    i3 = bottom;
                    bottom = top;
                }
                if (bottom <= (-i) && r0 >= (-i)) {
                    return i2;
                }
            }
            return -1;
        }

        private void ˋ(CoordinatorLayout coordinatorLayout, T t) {
            int ˏ = ˏ();
            int ˎ = ˎ((AppBarLayout) t, ˏ);
            if (ˎ >= 0) {
                View childAt = t.getChildAt(ˎ);
                LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
                int ˏ2 = layoutParams.ˏ();
                if ((ˏ2 & 17) == 17) {
                    int i = -childAt.getTop();
                    int i2 = -childAt.getBottom();
                    if (ˎ == t.getChildCount() - 1) {
                        i2 += t.ˊॱ();
                    }
                    if (ˏ(ˏ2, 2)) {
                        i2 += ViewCompat.ˋॱ(childAt);
                        ˎ = i;
                    } else if (ˏ(ˏ2, 5)) {
                        ˎ = ViewCompat.ˋॱ(childAt) + i2;
                        if (ˏ >= ˎ) {
                            i2 = ˎ;
                            ˎ = i;
                        }
                    } else {
                        ˎ = i;
                    }
                    if (ˏ(ˏ2, 32)) {
                        ˎ += layoutParams.topMargin;
                        i2 -= layoutParams.bottomMargin;
                    }
                    if (ˏ >= (i2 + ˎ) / 2) {
                        i2 = ˎ;
                    }
                    ˊ(coordinatorLayout, t, gr.ॱ(i2, -t.ॱ(), 0), 0.0f);
                }
            }
        }

        private static boolean ˏ(int i, int i2) {
            return (i & i2) == i2;
        }

        public boolean ˏ(CoordinatorLayout coordinatorLayout, T t, int i, int i2, int i3, int i4) {
            if (((a) t.getLayoutParams()).height != -2) {
                return super.ˎ(coordinatorLayout, t, i, i2, i3, i4);
            }
            coordinatorLayout.ˋ(t, i, i2, MeasureSpec.makeMeasureSpec(0, 0), i4);
            return true;
        }

        public boolean ॱ(CoordinatorLayout coordinatorLayout, T t, int i) {
            boolean ˎ = super.ˎ(coordinatorLayout, t, i);
            int ʼ = t.ʼ();
            if (this.ॱ >= 0 && (ʼ & 8) == 0) {
                int ˋॱ;
                View childAt = t.getChildAt(this.ॱ);
                ʼ = -childAt.getBottom();
                if (this.ʽ) {
                    ˋॱ = (ViewCompat.ˋॱ(childAt) + t.ˊॱ()) + ʼ;
                } else {
                    ˋॱ = Math.round(((float) childAt.getHeight()) * this.ʻ) + ʼ;
                }
                a_(coordinatorLayout, t, ˋॱ);
            } else if (ʼ != 0) {
                boolean z;
                if ((ʼ & 4) != 0) {
                    z = true;
                } else {
                    z = false;
                }
                if ((ʼ & 2) != 0) {
                    ʼ = -t.ˊ();
                    if (z) {
                        ˊ(coordinatorLayout, t, ʼ, 0.0f);
                    } else {
                        a_(coordinatorLayout, t, ʼ);
                    }
                } else if ((ʼ & 1) != 0) {
                    if (z) {
                        ˊ(coordinatorLayout, t, 0, 0.0f);
                    } else {
                        a_(coordinatorLayout, t, 0);
                    }
                }
            }
            t.ˏॱ();
            this.ॱ = -1;
            ˊ(gr.ॱ(ॱ(), -t.ॱ(), 0));
            ˎ(coordinatorLayout, t, ॱ(), 0, true);
            t.ˏ(ॱ());
            return ˎ;
        }

        boolean ˋ(T t) {
            if (this.ᐝ != null) {
                return this.ᐝ.ˏ(t);
            }
            if (this.ॱॱ == null) {
                return true;
            }
            View view = (View) this.ॱॱ.get();
            return (view == null || !view.isShown() || view.canScrollVertically(-1)) ? false : true;
        }

        void ॱ(CoordinatorLayout coordinatorLayout, T t) {
            ˋ(coordinatorLayout, (AppBarLayout) t);
        }

        int ˎ(T t) {
            return -t.ʻ();
        }

        int ˊ(T t) {
            return t.ॱ();
        }

        int ˊ(CoordinatorLayout coordinatorLayout, T t, int i, int i2, int i3) {
            int ˏ = ˏ();
            if (i2 == 0 || ˏ < i2 || ˏ > i3) {
                this.ˏ = 0;
                return 0;
            }
            int ॱ = gr.ॱ(i, i2, i3);
            if (ˏ == ॱ) {
                return 0;
            }
            int i4;
            int ˋ = t.ˎ() ? ˋ((AppBarLayout) t, ॱ) : ॱ;
            boolean ˊ = ˊ(ˋ);
            int i5 = ˏ - ॱ;
            this.ˏ = ॱ - ˋ;
            if (!ˊ && t.ˎ()) {
                coordinatorLayout.ˊ((View) t);
            }
            t.ˏ(ॱ());
            if (ॱ < ˏ) {
                i4 = -1;
            } else {
                i4 = 1;
            }
            ˎ(coordinatorLayout, t, ॱ, i4, false);
            return i5;
        }

        private int ˋ(T t, int i) {
            int abs = Math.abs(i);
            int childCount = t.getChildCount();
            int i2 = 0;
            while (i2 < childCount) {
                View childAt = t.getChildAt(i2);
                LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
                Interpolator ॱ = layoutParams.ॱ();
                if (abs < childAt.getTop() || abs > childAt.getBottom()) {
                    i2++;
                } else if (ॱ == null) {
                    return i;
                } else {
                    int height;
                    i2 = layoutParams.ˏ();
                    if ((i2 & 1) != 0) {
                        height = (layoutParams.bottomMargin + (childAt.getHeight() + layoutParams.topMargin)) + 0;
                        if ((i2 & 2) != 0) {
                            height -= ViewCompat.ˋॱ(childAt);
                        }
                    } else {
                        height = 0;
                    }
                    if (ViewCompat.ॱˋ(childAt)) {
                        height -= t.ˊॱ();
                    }
                    if (height <= 0) {
                        return i;
                    }
                    return Integer.signum(i) * (Math.round(ॱ.getInterpolation(((float) (abs - childAt.getTop())) / ((float) height)) * ((float) height)) + childAt.getTop());
                }
            }
            return i;
        }

        private void ˎ(CoordinatorLayout coordinatorLayout, T t, int i, int i2, boolean z) {
            boolean z2 = true;
            View ॱ = ॱ((AppBarLayout) t, i);
            if (ॱ != null) {
                boolean z3;
                int ˏ = ((LayoutParams) ॱ.getLayoutParams()).ˏ();
                if ((ˏ & 1) != 0) {
                    int ˋॱ = ViewCompat.ˋॱ(ॱ);
                    if (i2 > 0 && (ˏ & 12) != 0) {
                        z3 = (-i) >= (ॱ.getBottom() - ˋॱ) - t.ˊॱ();
                        if (t.ᐝ()) {
                            ॱ = ॱ(coordinatorLayout);
                            if (ॱ != null) {
                                if (ॱ.getScrollY() <= 0) {
                                    z2 = false;
                                }
                                z3 = z2;
                            }
                        }
                        z3 = t.ˊ(z3);
                        if (VERSION.SDK_INT >= 11) {
                            if (!z) {
                            }
                            t.jumpDrawablesToCurrentState();
                        }
                    } else if ((ˏ & 2) != 0) {
                        z3 = (-i) >= (ॱ.getBottom() - ˋॱ) - t.ˊॱ();
                        if (t.ᐝ()) {
                            ॱ = ॱ(coordinatorLayout);
                            if (ॱ != null) {
                                if (ॱ.getScrollY() <= 0) {
                                    z2 = false;
                                }
                                z3 = z2;
                            }
                        }
                        z3 = t.ˊ(z3);
                        if (VERSION.SDK_INT >= 11) {
                        }
                        if (z || (z3 && ˏ(coordinatorLayout, (AppBarLayout) t))) {
                            t.jumpDrawablesToCurrentState();
                        }
                        return;
                    }
                }
                z3 = false;
                if (t.ᐝ()) {
                    ॱ = ॱ(coordinatorLayout);
                    if (ॱ != null) {
                        if (ॱ.getScrollY() <= 0) {
                            z2 = false;
                        }
                        z3 = z2;
                    }
                }
                z3 = t.ˊ(z3);
                if (VERSION.SDK_INT >= 11) {
                    if (z) {
                    }
                    t.jumpDrawablesToCurrentState();
                }
            }
        }

        private boolean ˏ(CoordinatorLayout coordinatorLayout, T t) {
            List ॱ = coordinatorLayout.ॱ((View) t);
            int size = ॱ.size();
            int i = 0;
            while (i < size) {
                androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior ˋ = ((a) ((View) ॱ.get(i)).getLayoutParams()).ˋ();
                if (!(ˋ instanceof ScrollingViewBehavior)) {
                    i++;
                } else if (((ScrollingViewBehavior) ˋ).ˏ() != 0) {
                    return true;
                } else {
                    return false;
                }
            }
            return false;
        }

        private static View ॱ(AppBarLayout appBarLayout, int i) {
            int abs = Math.abs(i);
            int childCount = appBarLayout.getChildCount();
            for (int i2 = 0; i2 < childCount; i2++) {
                View childAt = appBarLayout.getChildAt(i2);
                if (abs >= childAt.getTop() && abs <= childAt.getBottom()) {
                    return childAt;
                }
            }
            return null;
        }

        @Nullable
        private View ॱ(CoordinatorLayout coordinatorLayout) {
            int childCount = coordinatorLayout.getChildCount();
            for (int i = 0; i < childCount; i++) {
                View childAt = coordinatorLayout.getChildAt(i);
                if (childAt instanceof hq) {
                    return childAt;
                }
            }
            return null;
        }

        int ˏ() {
            return ॱ() + this.ˏ;
        }

        public Parcelable ˎ(CoordinatorLayout coordinatorLayout, T t) {
            boolean z = false;
            Parcelable ˎ = super.ˎ(coordinatorLayout, t);
            int ॱ = ॱ();
            int childCount = t.getChildCount();
            int i = 0;
            while (i < childCount) {
                View childAt = t.getChildAt(i);
                int bottom = childAt.getBottom() + ॱ;
                if (childAt.getTop() + ॱ > 0 || bottom < 0) {
                    i++;
                } else {
                    SavedState savedState = new SavedState(ˎ);
                    savedState.ॱ = i;
                    if (bottom == ViewCompat.ˋॱ(childAt) + t.ˊॱ()) {
                        z = true;
                    }
                    savedState.ˋ = z;
                    savedState.ˏ = ((float) bottom) / ((float) childAt.getHeight());
                    return savedState;
                }
            }
            return ˎ;
        }

        public void ˎ(CoordinatorLayout coordinatorLayout, T t, Parcelable parcelable) {
            if (parcelable instanceof SavedState) {
                SavedState savedState = (SavedState) parcelable;
                super.ˊ(coordinatorLayout, t, savedState.ˊ());
                this.ॱ = savedState.ॱ;
                this.ʻ = savedState.ˏ;
                this.ʽ = savedState.ˋ;
                return;
            }
            super.ˊ(coordinatorLayout, t, parcelable);
            this.ॱ = -1;
        }
    }

    public static class Behavior extends BaseBehavior<AppBarLayout> {
        public /* bridge */ /* synthetic */ boolean ˊ(int i) {
            return super.ˊ(i);
        }

        public /* bridge */ /* synthetic */ void ˋ(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, View view, int i, int i2, int i3, int i4, int i5) {
            super.ˋ(coordinatorLayout, appBarLayout, view, i, i2, i3, i4, i5);
        }

        public /* bridge */ /* synthetic */ Parcelable ˎ(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout) {
            return super.ˎ(coordinatorLayout, appBarLayout);
        }

        public /* bridge */ /* synthetic */ void ˎ(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, Parcelable parcelable) {
            super.ˎ(coordinatorLayout, appBarLayout, parcelable);
        }

        public /* bridge */ /* synthetic */ void ˏ(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, View view, int i, int i2, int[] iArr, int i3) {
            super.ˏ(coordinatorLayout, appBarLayout, view, i, i2, iArr, i3);
        }

        public /* bridge */ /* synthetic */ int ॱ() {
            return super.ॱ();
        }

        public /* bridge */ /* synthetic */ void ॱ(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, View view, int i) {
            super.ॱ(coordinatorLayout, appBarLayout, view, i);
        }

        public /* bridge */ /* synthetic */ boolean ॱ(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, int i) {
            return super.ॱ(coordinatorLayout, appBarLayout, i);
        }

        public Behavior(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
        }
    }

    public static class LayoutParams extends android.widget.LinearLayout.LayoutParams {
        int ˏ = 1;
        Interpolator ॱ;

        @RestrictTo({androidx.annotation.RestrictTo.d.LIBRARY_GROUP})
        @Retention(RetentionPolicy.SOURCE)
        public @interface ScrollFlags {
        }

        public LayoutParams(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, n.ˊॱ);
            this.ˏ = obtainStyledAttributes.getInt(n.ᐝॱ, 0);
            if (obtainStyledAttributes.hasValue(n.ʻॱ)) {
                this.ॱ = AnimationUtils.loadInterpolator(context, obtainStyledAttributes.getResourceId(n.ʻॱ, 0));
            }
            obtainStyledAttributes.recycle();
        }

        public LayoutParams(int i, int i2) {
            super(i, i2);
        }

        public LayoutParams(android.view.ViewGroup.LayoutParams layoutParams) {
            super(layoutParams);
        }

        public LayoutParams(MarginLayoutParams marginLayoutParams) {
            super(marginLayoutParams);
        }

        @RequiresApi(19)
        public LayoutParams(android.widget.LinearLayout.LayoutParams layoutParams) {
            super(layoutParams);
        }

        public int ˏ() {
            return this.ˏ;
        }

        public Interpolator ॱ() {
            return this.ॱ;
        }

        boolean ˊ() {
            return (this.ˏ & 1) == 1 && (this.ˏ & 10) != 0;
        }
    }

    public static class ScrollingViewBehavior extends HeaderScrollingViewBehavior {
        public /* bridge */ /* synthetic */ boolean ˎ(CoordinatorLayout coordinatorLayout, View view, int i) {
            return super.ˎ(coordinatorLayout, view, i);
        }

        public /* bridge */ /* synthetic */ boolean ˎ(CoordinatorLayout coordinatorLayout, View view, int i, int i2, int i3, int i4) {
            return super.ˎ(coordinatorLayout, view, i, i2, i3, i4);
        }

        public /* bridge */ /* synthetic */ int ॱ() {
            return super.ॱ();
        }

        /* synthetic */ View ॱ(List list) {
            return ˏ(list);
        }

        public ScrollingViewBehavior(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, n.ˌˎ);
            ˏ(obtainStyledAttributes.getDimensionPixelSize(n.ˌᐝ, 0));
            obtainStyledAttributes.recycle();
        }

        public boolean ॱ(CoordinatorLayout coordinatorLayout, View view, View view2) {
            return view2 instanceof AppBarLayout;
        }

        public boolean ˋ(CoordinatorLayout coordinatorLayout, View view, View view2) {
            ˏ(view, view2);
            ˎ(view, view2);
            return false;
        }

        public boolean ˎ(CoordinatorLayout coordinatorLayout, View view, Rect rect, boolean z) {
            AppBarLayout ˏ = ˏ(coordinatorLayout.ˏ(view));
            if (ˏ != null) {
                rect.offset(view.getLeft(), view.getTop());
                Rect rect2 = this.ˏ;
                rect2.set(0, 0, coordinatorLayout.getWidth(), coordinatorLayout.getHeight());
                if (!rect2.contains(rect)) {
                    boolean z2;
                    if (z) {
                        z2 = false;
                    } else {
                        z2 = true;
                    }
                    ˏ.setExpanded(false, z2);
                    return true;
                }
            }
            return false;
        }

        private void ˏ(View view, View view2) {
            androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior ˋ = ((a) view2.getLayoutParams()).ˋ();
            if (ˋ instanceof BaseBehavior) {
                int bottom = view2.getBottom() - view.getTop();
                ViewCompat.ʽ(view, ((((BaseBehavior) ˋ).ˏ + bottom) + ˋ()) - ˏ(view2));
            }
        }

        float ˊ(View view) {
            if (!(view instanceof AppBarLayout)) {
                return 0.0f;
            }
            AppBarLayout appBarLayout = (AppBarLayout) view;
            int ॱ = appBarLayout.ॱ();
            int ʽ = appBarLayout.ʽ();
            int ॱ2 = ॱ(appBarLayout);
            if (ʽ != 0 && ॱ + ॱ2 <= ʽ) {
                return 0.0f;
            }
            ॱ -= ʽ;
            if (ॱ != 0) {
                return 1.0f + (((float) ॱ2) / ((float) ॱ));
            }
            return 0.0f;
        }

        private static int ॱ(AppBarLayout appBarLayout) {
            androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior ˋ = ((a) appBarLayout.getLayoutParams()).ˋ();
            if (ˋ instanceof BaseBehavior) {
                return ((BaseBehavior) ˋ).ˏ();
            }
            return 0;
        }

        AppBarLayout ˏ(List<View> list) {
            int size = list.size();
            for (int i = 0; i < size; i++) {
                View view = (View) list.get(i);
                if (view instanceof AppBarLayout) {
                    return (AppBarLayout) view;
                }
            }
            return null;
        }

        int ॱ(View view) {
            if (view instanceof AppBarLayout) {
                return ((AppBarLayout) view).ॱ();
            }
            return super.ॱ(view);
        }

        private void ˎ(View view, View view2) {
            if (view2 instanceof AppBarLayout) {
                AppBarLayout appBarLayout = (AppBarLayout) view2;
                if (appBarLayout.ᐝ()) {
                    appBarLayout.ˊ(view.getScrollY() > 0);
                }
            }
        }
    }

    public interface d<T extends AppBarLayout> {
        void ˊ(T t, int i);
    }

    public interface c extends d<AppBarLayout> {
    }

    protected /* synthetic */ android.view.ViewGroup.LayoutParams generateDefaultLayoutParams() {
        return ˋ();
    }

    protected /* synthetic */ android.widget.LinearLayout.LayoutParams m3generateDefaultLayoutParams() {
        return ˋ();
    }

    public /* synthetic */ android.view.ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
        return ˋ(attributeSet);
    }

    protected /* synthetic */ android.view.ViewGroup.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams layoutParams) {
        return ˊ(layoutParams);
    }

    public /* synthetic */ android.widget.LinearLayout.LayoutParams m4generateLayoutParams(AttributeSet attributeSet) {
        return ˋ(attributeSet);
    }

    protected /* synthetic */ android.widget.LinearLayout.LayoutParams m5generateLayoutParams(android.view.ViewGroup.LayoutParams layoutParams) {
        return ˊ(layoutParams);
    }

    public AppBarLayout(Context context) {
        this(context, null);
    }

    public AppBarLayout(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.ॱ = -1;
        this.ˎ = -1;
        this.ˊ = -1;
        this.ˋ = 0;
        setOrientation(1);
        if (VERSION.SDK_INT >= 21) {
            arf.ॱ(this);
            arf.ॱ(this, attributeSet, 0, f.ˏ);
        }
        TypedArray ॱ = asa.ॱ(context, attributeSet, n.ʽ, 0, f.ˏ, new int[0]);
        ViewCompat.ˏ(this, ॱ.getDrawable(n.ॱॱ));
        if (ॱ.hasValue(n.ˋॱ)) {
            ˏ(ॱ.getBoolean(n.ˋॱ, false), false, false);
        }
        if (VERSION.SDK_INT >= 21 && ॱ.hasValue(n.ͺ)) {
            arf.ˎ(this, (float) ॱ.getDimensionPixelSize(n.ͺ, 0));
        }
        if (VERSION.SDK_INT >= 26) {
            if (ॱ.hasValue(n.ʼ)) {
                setKeyboardNavigationCluster(ॱ.getBoolean(n.ʼ, false));
            }
            if (ॱ.hasValue(n.ᐝ)) {
                setTouchscreenBlocksFocus(ॱ.getBoolean(n.ᐝ, false));
            }
        }
        this.ॱˊ = ॱ.getBoolean(n.ॱˊ, false);
        ॱ.recycle();
        ViewCompat.ˋ(this, new hx(this) {
            final /* synthetic */ AppBarLayout ˎ;

            {
                this.ˎ = r1;
            }

            public ij ˋ(View view, ij ijVar) {
                return this.ˎ.ˊ(ijVar);
            }
        });
    }

    public void ˋ(d dVar) {
        if (this.ᐝ == null) {
            this.ᐝ = new ArrayList();
        }
        if (dVar != null && !this.ᐝ.contains(dVar)) {
            this.ᐝ.add(dVar);
        }
    }

    public void ˋ(c cVar) {
        ˋ((d) cVar);
    }

    public void ˊ(d dVar) {
        if (this.ᐝ != null && dVar != null) {
            this.ᐝ.remove(dVar);
        }
    }

    public void ˎ(c cVar) {
        ˊ((d) cVar);
    }

    protected void onMeasure(int i, int i2) {
        super.onMeasure(i, i2);
        ॱˊ();
    }

    protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
        super.onLayout(z, i, i2, i3, i4);
        ॱˊ();
        this.ˏ = false;
        int childCount = getChildCount();
        for (int i5 = 0; i5 < childCount; i5++) {
            if (((LayoutParams) getChildAt(i5).getLayoutParams()).ॱ() != null) {
                this.ˏ = true;
                break;
            }
        }
        if (!this.ॱॱ) {
            boolean z2 = this.ॱˊ || ͺ();
            ॱ(z2);
        }
    }

    private boolean ͺ() {
        int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            if (((LayoutParams) getChildAt(i).getLayoutParams()).ˊ()) {
                return true;
            }
        }
        return false;
    }

    private void ॱˊ() {
        this.ॱ = -1;
        this.ˎ = -1;
        this.ˊ = -1;
    }

    public void setOrientation(int i) {
        if (i != 1) {
            throw new IllegalArgumentException("AppBarLayout is always vertical and does not support horizontal orientation");
        }
        super.setOrientation(i);
    }

    public void setExpanded(boolean z) {
        setExpanded(z, ViewCompat.ˊᐝ(this));
    }

    public void setExpanded(boolean z, boolean z2) {
        ˏ(z, z2, true);
    }

    private void ˏ(boolean z, boolean z2, boolean z3) {
        int i = 0;
        int i2 = (z2 ? 4 : 0) | (z ? 1 : 2);
        if (z3) {
            i = 8;
        }
        this.ˋ = i | i2;
        requestLayout();
    }

    protected boolean checkLayoutParams(android.view.ViewGroup.LayoutParams layoutParams) {
        return layoutParams instanceof LayoutParams;
    }

    protected LayoutParams ˋ() {
        return new LayoutParams(-1, -2);
    }

    public LayoutParams ˋ(AttributeSet attributeSet) {
        return new LayoutParams(getContext(), attributeSet);
    }

    protected LayoutParams ˊ(android.view.ViewGroup.LayoutParams layoutParams) {
        if (VERSION.SDK_INT >= 19 && (layoutParams instanceof android.widget.LinearLayout.LayoutParams)) {
            return new LayoutParams((android.widget.LinearLayout.LayoutParams) layoutParams);
        }
        if (layoutParams instanceof MarginLayoutParams) {
            return new LayoutParams((MarginLayoutParams) layoutParams);
        }
        return new LayoutParams(layoutParams);
    }

    boolean ˎ() {
        return this.ˏ;
    }

    public final int ॱ() {
        if (this.ॱ != -1) {
            return this.ॱ;
        }
        int ˋॱ;
        int childCount = getChildCount();
        int i = 0;
        for (int i2 = 0; i2 < childCount; i2++) {
            View childAt = getChildAt(i2);
            LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
            int measuredHeight = childAt.getMeasuredHeight();
            int i3 = layoutParams.ˏ;
            if ((i3 & 1) == 0) {
                break;
            }
            i += layoutParams.bottomMargin + (measuredHeight + layoutParams.topMargin);
            if ((i3 & 2) != 0) {
                ˋॱ = i - ViewCompat.ˋॱ(childAt);
                break;
            }
        }
        ˋॱ = i;
        ˋॱ = Math.max(0, ˋॱ - ˊॱ());
        this.ॱ = ˋॱ;
        return ˋॱ;
    }

    boolean ˏ() {
        return ॱ() != 0;
    }

    int ˊ() {
        return ॱ();
    }

    int ʽ() {
        if (this.ˎ != -1) {
            return this.ˎ;
        }
        int i;
        int childCount = getChildCount() - 1;
        int i2 = 0;
        while (childCount >= 0) {
            View childAt = getChildAt(childCount);
            LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
            int measuredHeight = childAt.getMeasuredHeight();
            int i3 = layoutParams.ˏ;
            if ((i3 & 5) == 5) {
                i = (layoutParams.bottomMargin + layoutParams.topMargin) + i2;
                if ((i3 & 8) != 0) {
                    i += ViewCompat.ˋॱ(childAt);
                } else if ((i3 & 2) != 0) {
                    i += measuredHeight - ViewCompat.ˋॱ(childAt);
                } else {
                    i += measuredHeight - ˊॱ();
                }
            } else if (i2 > 0) {
                break;
            } else {
                i = i2;
            }
            childCount--;
            i2 = i;
        }
        i = Math.max(0, i2);
        this.ˎ = i;
        return i;
    }

    int ʻ() {
        if (this.ˊ != -1) {
            return this.ˊ;
        }
        int i;
        int childCount = getChildCount();
        int i2 = 0;
        for (int i3 = 0; i3 < childCount; i3++) {
            View childAt = getChildAt(i3);
            LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
            int measuredHeight = childAt.getMeasuredHeight() + (layoutParams.topMargin + layoutParams.bottomMargin);
            i = layoutParams.ˏ;
            if ((i & 1) == 0) {
                break;
            }
            i2 += measuredHeight;
            if ((i & 2) != 0) {
                i = i2 - (ViewCompat.ˋॱ(childAt) + ˊॱ());
                break;
            }
        }
        i = i2;
        i = Math.max(0, i);
        this.ˊ = i;
        return i;
    }

    void ˏ(int i) {
        if (this.ᐝ != null) {
            int size = this.ᐝ.size();
            for (int i2 = 0; i2 < size; i2++) {
                d dVar = (d) this.ᐝ.get(i2);
                if (dVar != null) {
                    dVar.ˊ(this, i);
                }
            }
        }
    }

    public final int ॱॱ() {
        int ˊॱ = ˊॱ();
        int ˋॱ = ViewCompat.ˋॱ(this);
        if (ˋॱ != 0) {
            return (ˋॱ * 2) + ˊॱ;
        }
        ˋॱ = getChildCount();
        ˋॱ = ˋॱ >= 1 ? ViewCompat.ˋॱ(getChildAt(ˋॱ - 1)) : 0;
        if (ˋॱ != 0) {
            return (ˋॱ * 2) + ˊॱ;
        }
        return getHeight() / 3;
    }

    protected int[] onCreateDrawableState(int i) {
        if (this.ͺ == null) {
            this.ͺ = new int[4];
        }
        int[] iArr = this.ͺ;
        int[] onCreateDrawableState = super.onCreateDrawableState(iArr.length + i);
        iArr[0] = this.ʻ ? o.aqu.d.ॱˎ : -o.aqu.d.ॱˎ;
        int i2 = (this.ʻ && this.ʽ) ? o.aqu.d.ᐝॱ : -o.aqu.d.ᐝॱ;
        iArr[1] = i2;
        iArr[2] = this.ʻ ? o.aqu.d.ॱˋ : -o.aqu.d.ॱˋ;
        i2 = (this.ʻ && this.ʽ) ? o.aqu.d.ˏॱ : -o.aqu.d.ˏॱ;
        iArr[3] = i2;
        return mergeDrawableStates(onCreateDrawableState, iArr);
    }

    private boolean ॱ(boolean z) {
        if (this.ʻ == z) {
            return false;
        }
        this.ʻ = z;
        refreshDrawableState();
        return true;
    }

    boolean ˊ(boolean z) {
        if (this.ʽ == z) {
            return false;
        }
        this.ʽ = z;
        refreshDrawableState();
        return true;
    }

    public void setLiftOnScroll(boolean z) {
        this.ॱˊ = z;
    }

    public boolean ᐝ() {
        return this.ॱˊ;
    }

    @Deprecated
    public void setTargetElevation(float f) {
        if (VERSION.SDK_INT >= 21) {
            arf.ˎ(this, f);
        }
    }

    int ʼ() {
        return this.ˋ;
    }

    void ˏॱ() {
        this.ˋ = 0;
    }

    @VisibleForTesting
    final int ˊॱ() {
        return this.ʼ != null ? this.ʼ.ˎ() : 0;
    }

    ij ˊ(ij ijVar) {
        ij ijVar2 = null;
        if (ViewCompat.ॱˋ(this)) {
            ijVar2 = ijVar;
        }
        if (!gz.ˏ(this.ʼ, ijVar2)) {
            this.ʼ = ijVar2;
            ॱˊ();
        }
        return ijVar;
    }
}
